<?php
/**
 * 描述：返回店铺列表
 * @param  string
 * @return array         
 */
function shop_list($where=array('is_valid'=>array('in','1,2')),$field='id,title') {
	$mod=new ShopLibModel();
	$mod->setModWhere($where);
	$listTmp = $mod->field($field)->select();
	$list = array();
	foreach ($listTmp as $key=>$value){
		$list[$value['id']] =  $value;
	}
	unset($listTmp);
	//F('shop_list',$list);
    return $list;
}

/**
 * 描述：返回角色列表
 * @param  string
 * @return array
 */
function role_list($where=array('is_valid'=>array('in','1,2')),$field='id,name,title') {
	$mod=new ShopUserRoleModel();
	$mod->setModWhere($where);
	$listTmp = $mod->field($field)->select();
	$list = array();
	foreach ($listTmp as $key=>$value){
		$list[$value['name']] =  $value;
	}
	unset($listTmp);
	//F('role_list',$list);
	return $list;
}

/**
 * 描述：返回供应商列表
 * @param  string
 * @return array
 */
function supplyer_list($where=array('is_valid'=>array('in','1,2')),$field='id,title') {
	$mod=new ShopSupplyerModel();
	$mod->setModWhere($where);
	$listTmp = $mod->field($field)->select();
	$list = array();
	foreach ($listTmp as $key=>$value){
		$list[$value['id']] =  $value;
	}
	unset($listTmp);
	//F('supplyer_list',$list);
	return $list;
}

/**
 * 描述：返回分类列表
 * @param  string
 * @return array
 */
function productcate_tree($where=array('is_valid'=>array('in','1,2')),$field='id,code,title,pid') {
	$cateTree = F('productcate_tree');
	if(!$cateTree){
		$mod=new ProductCateModel();
		$mod->setModWhere($where);
		$cate = $mod->field($field)->select();
		$cateTree = list_to_tree($cate);
		F('productcate_tree',$cateTree);
	}
	return $cateTree;
}

/**
 * 描述：返回分类列表
 * @param  string
 * @return array
 */
function publiccate_list($where=array('is_valid'=>array('in','1,2')),$field='id,type,title') {
	$list = F('publiccate_list');
	if(!$list){
		$mod=new PublicCateModel();
		$mod->setModWhere($where);
		$list = $mod->field($field)->order('type,ordlist')->select();
		F('publiccate_list',$list);
	}
	return $list;
}

/**
 * 描述：返回车分类名称
 * @param  string  $cate1 分类ID
 * @return array         婚车相册分类名称
 */
function hc_cate1_name($cate1) {
	//HS_CATE1 参照 confing/custom.php
	$list = C('HC_CATE1');
	return $list[$cate1];
}

?>